import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);
const routes = [
    {
        path: '/',
        name: 'Home',
        component: () => import( '@/views/home'),
        children:[
            {
                path: '/index',
                name: 'index',
                component: () => import( '@/views/index'),
            },

            /**
             * 菜单管理
             */
            // 菜单列表
            {
                path: '/menu',
                name: 'menu',
                component: () => import( '@/views/menu/menu'),
            },
            // 菜单添加
            {
                path: '/menu/add',
                name: 'menu',
                component: () => import( '@/views/menu/add'),
            },
            // 菜单修改
            {
                path: '/menu/edit',
                name: 'menu',
                component: () => import( '@/views/menu/edit'),
            },

            /**
             * 管理员管理
             */

            // 管理员列表
            {
                path: '/manger',
                name: 'manger',
                component: () => import( '@/views/manger/manger'),
            },
            // 管理员添加
            {
                path: '/manger/add',
                name: 'add',
                component: () => import( '@/views/manger/add'),
            },
            // 管理员修改
            {
                path: '/manger/edit',
                name: 'edit',
                component: () => import( '@/views/manger/edit'),
            },
            // 权限管理
            {
                path: '/group',
                name: 'group',
                component: () => import( '@/views/group/group'),
            },
            /**
             * 模型管理
             */
            // 模型列表
            {
                path: '/model',
                name: 'model',
                component: () => import( '@/views/model/model'),
            },
            // 模型添加
            {
                path: '/model/add',
                name: 'model',
                component: () => import( '@/views/model/add'),
            },
            // 模型修改
            // {
            //     path: '/menu/edit',
            //     name: 'menu',
            //     component: () => import( '@/views/menu/edit'),
            // },
        ]

    },
    {
        path: '/login',
        name: 'login',
        component: () => import( '@/views/login'),

    },

]
let routerPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
    return routerPush.call(this, location).catch(err => err)
}

const router = new VueRouter({
    // mode:'history',
    routes
})

export default router

